package 方法重载 ;

//不同数据类型比较是否相等

public class test02 {
    public static void main(String[] args) {

        System.out.println(compare(10, 20));

        System.out.println(compare((short) 10, (short) 20));

        System.out.println(compare((char) 10, (char) 20));

        System.out.println(compare(10L, 20L));
    }

    public static boolean compare(int a, int b) {
        System.out.println("int");
        return a == b;
    }

    public static boolean compare(short a, short b) {
        System.out.println("short ");
        return a == b;
    }

    public static boolean compare(char a, char b) {
        System.out.println("char");
        return a == b;
    }

    public static boolean compare(long a, long b) {
        System.out.println("long");
        return a == b;
    }

}

